using UnityEngine;
using System.Collections;

public class ReportScript : MonoBehaviour {
		
	public int reportFrames = 10;//When the log is written
	string currentObj;
	
	// Use this for initialization
	void Start () {
	currentObj = transform.name.ToString();
		StartCoroutine(ReportCounter());
	}
	
	// Update is called once per frame
	void Update () {
	
	}
	
	
	void AddToLine(string cause)
	{
		
		string now = ("Obj: "+currentObj+" Reason: "+cause+" Location X: "+transform.position.x+" , Y: "+transform.position.y+" , Z: "+transform.position.z+
				" , Rotation X: " + transform.rotation.x+" , Y: "+ transform.rotation.y+" , Z: "+ transform.rotation.z+
				" , Scale X: "+transform.localScale.x+" , Y: "+transform.localScale.y+" , Z: " +transform.localScale.z+" Time: " +Time.time+ '\n');
			LogScript.CurrentInfo.Add(now);
	
		
	}
	
	IEnumerator ReportCounter ()
	{
		while(true)
		{
			for (int i=0; i<reportFrames; i++)
			{
	    		yield return null;
				
			}
			AddToLine("Log");
		}
		
	}
	
	void OnCollisionEnter(Collision collision)
	{
		AddToLine("Collision");
	}
	
	 void OnTriggerEnter(Collider other)
	{
		AddToLine("Trigger");
	}
}
